package vn.sunnet.game.SinhTon.object;

import vn.sunnet.game.SinhTon.global.Assets;
import vn.sunnet.game.SinhTon.global.Setting;

import com.badlogic.gdx.graphics.g2d.TextureRegion;

public class GunShopObject extends GameObject {
	private int id;
	private TextureRegion texture, textureSung;
	private int damage; // Tỷ lệ sát thương - máu
	private float timeFire; // Thời gian ra 1 vien dan
	private int timeReload; // Thời gian thay đạn
	private int number; // Số lượng đạn
	private int damageRegion; // Bán kính ảnh hưởng
	private int coinValue; // Số xu để mua
	private boolean isCanBuy; // dieu kie la phai qua map

	public GunShopObject(int id) {
		super(92 + 154 * (id - 2), 66, 128, 92);
		this.id = id;
		initGun();
	}
	
	private void initGun() {
		switch (id) {
		case 1:
			damage = 5;
			timeReload = 0;
			number = 4;
			damageRegion = 0;
			coinValue = 0;
			timeFire = 0.11f;
			isCanBuy = true;
			break;

		case 2:
			damage = 8;
			timeReload = 0;
			number = 4;
			damageRegion = 0;
			coinValue = 1200;
			timeFire = 0.11f;
			isCanBuy = Setting.getBoolean("MAP" + 2);
			break;
		case 3:
			damage = 10;
			timeReload = 0;
			number = 4;
			damageRegion = 0;
			coinValue = 1800;
			timeFire = 0.11f;
			isCanBuy = Setting.getBoolean("MAP" + 3);
			break;
		case 4:
			damage = 12;
			timeReload = 0;
			number = 4;
			damageRegion = 0;
			coinValue = 2200;
			timeFire = 0.11f;
			isCanBuy = Setting.getBoolean("MAP" + 4);
			break;
		case 5:
			damage = 20;
			timeReload = 3;
			number = 4;
			damageRegion = 0;
			coinValue = 2800;
			timeFire = 3f;
			isCanBuy = Setting.getBoolean("MAP" + 5);
			break;
		case 6:
			damage = 25;
			timeReload = 4;
			number = 4;
			damageRegion = 150;
			coinValue = 3200;
			timeFire = 4f;
			isCanBuy = Setting.getBoolean("MAP" + 6);
			break;
		}
	}

	public int getId(){
		return id;
	}
	
	public int getDamage() {
		return damage;
	}

	public int getTimeReload() {
		return timeReload;
	}

	public int getNumber() {
		return number;
	}

	public int getDamageRegion() {
		return damageRegion;
	}

	public int getCoinValue() {
		return coinValue;
	}

	public TextureRegion getTexture() {
		texture = Assets.trGun.get(id - 1);
		return texture;
	}
	
	public TextureRegion getTexture_hover() {
		texture = Assets.trGun_hover.get(id - 1);
		return texture;
	}

	public TextureRegion getTextureSung() {
		textureSung = Assets.trSung.get(id - 1);
		return textureSung;
	}

	public float getTimeFire() {
		return timeFire;
	}
	
	public boolean isCanBuy() {
		//return isCanBuy;
		return true;
	}

}
